package com.hsh.server.project.bank.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.hsh.server.common.controller.BaseController;
import com.hsh.server.project.bank.domain.TAppBalance;
import com.hsh.server.project.bank.service.ITAppBalanceService;
import com.hsh.server.util.R;
import com.hsh.server.util.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.hsh.server.util.PageUtils.startPage;

/**
 * 余额Controller
 * 
 * @author ruoyi
 * @date 2025-04-23
 */
@RestController
@RequestMapping("/system/balance")
public class TAppBalanceController extends BaseController
{
    @Autowired
    private ITAppBalanceService tAppBalanceService;

    /**
     * 查询余额列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TAppBalance tAppBalance)
    {
        startPage();
        List<TAppBalance> list = tAppBalanceService.selectTAppBalanceList(tAppBalance);
        return getDataTable(list);
    }

    /**
     * 获取余额详细信息
     */
    @GetMapping(value = "/{id}")
    public R getInfo(@PathVariable("id") Long id)
    {
        return R.success(tAppBalanceService.selectTAppBalanceById(id));
    }

    /**
     * 新增余额
     */
    @PostMapping
    public R add(@RequestBody TAppBalance tAppBalance)
    {
        return R.success(tAppBalanceService.insertTAppBalance(tAppBalance));
    }

    /**
     * 修改余额
     */
    @PutMapping
    public R edit(@RequestBody TAppBalance tAppBalance)
    {
        return R.success(tAppBalanceService.updateTAppBalance(tAppBalance));
    }

    /**
     * 删除余额
     */
	@DeleteMapping("/{ids}")
    public R remove(@PathVariable Long[] ids)
    {
        return R.success(tAppBalanceService.deleteTAppBalanceByIds(ids));
    }
}
